{{!-- 
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--}}
<div class="serviceInfo row-fluid">
  <div class="pull-left">
    <p>
      <strong>{{tt 'lbl.serivceName'}} :</strong> {{PolicyDetails.service}}
    </p>
  </div>
  <div class="pull-right">
    <p>
      <strong>{{tt 'lbl.serivceType'}} :</strong> {{PolicyDetails.serviceType}}
    </p>
  </div>
</div>
<div id="policyDetails" class="row-fluid">
  <p class="formHeader">
    {{tt 'h.policyDetails'}} : 
  </p>
  <table class="table table-bordered table-condensed">
    <tbody>
      <tr>
        <td>
          {{tt 'lbl.policyId'}}
        </td>
        <td>
          <div class="controls"><label class="label label-ranger" style="cursor: auto;">{{PolicyDetails.id}}</label></div>
        </td>
      </tr>
      <tr>
        <td>
          {{tt 'lbl.policyName'}}
        </td>
        <td>
          {{PolicyDetails.name}}
          <span class="label label-inverse pull-right">{{PolicyDetails.isEnabled}}</span>
        </td>
      </tr>
      {{#each PolicyDetails.resources}}
      <tr>
        <td>
          {{this.label}}
        </td>
        <td>
          {{#each this.values}}
            <span class="label label-info">{{this}}</span>
          {{/each}}
          <span class="label label-inverse pull-right">{{this.Rec_Exc}}</span>
        </td>
      </tr>
      {{/each}}
      <tr>
        <td>
          {{tt 'lbl.description'}}
        </td>
        <td>
          {{PolicyDetails.description}}
        </td>
      </tr>
      </tr>
        <td>
          {{tt 'lbl.auditLogging'}}
        </td>
        <td>
          <span class="label label-info">{{PolicyDetails.isAuditEnabled}}</span>
        </td>
      </tr>
    </tbody>
  </table>
</div>

{{#each PolicyDetails.policyItemsCond}}
	<div id="policyItems" class="row-fluid">
	  <p class="formHeader">
	    {{this.title}}  :
	  </p>
	  <table class="table-permission table-condensed table-read-only" style="width:100%">
	    <thead>
	      <tr>
	        {{#each this.headers}}
	        	<th>{{this}}</th>
	        {{/each}}
	      </tr>
	    </thead>
	    <tbody>
	      {{#each this.policyItems}}
	      <tr>
	        <td>{{#each this.groups}}
	          <span class="label label-info">{{this}}</span>
	          {{/each}}</td>
	        <td>{{#each this.users}}
	          <span class="label label-info">{{this}}</span>
	          {{/each}}</td>
	        {{#if ../../PolicyDetails.policyCondition}}
	 			<td>
	 	  		{{#if this.conditions}}	
	    	  		{{#each this.conditions}}
	       				<span class="label label-info">
		         			{{this.type}} :
		         			{{#each this.values}}
		           				{{this}}
		         			{{/each}}
	       				</span>
	       			{{/each}}
	    		{{else}}
	     			--  
	     		{{/if}}
	       	</td>
	       {{/if}}
	        <td>{{#each this.accesses}}
	          <span class="label label-info">{{#if this.isAllowed}}{{this.type}}{{/if}}</span>
	          {{/each}}</td>
	        <td>
	          <input type="checkbox" {{#if this.delegateAdmin}}checked{{/if}} disabled="disabled">
	        </td>
	      </tr>
	      {{/each}}
	    </tbody>
	  </table>
	</div>
{{/each}}
<div class="updateInfo row-fluid">
  <div class="pull-left">
    <p>
      <strong>{{tt 'lbl.updatedBy'}} :</strong> {{PolicyDetails.updatedBy}}
    </p>
    <p>
      <strong>{{tt 'lbl.updatedOn'}} :</strong> {{PolicyDetails.updateTime}}
    </p>
  </div>
  <div class="pull-right">
    <p>
      <strong>{{tt 'lbl.createdBy'}} :</strong> {{PolicyDetails.createdBy}}
    </p>
    <p>
      <strong>{{tt 'lbl.createdOn'}} :</strong> {{PolicyDetails.createTime}}
    </p>
  </div>
</div>
